package dch.service.admin.impl;

import java.util.List;

import org.apache.log4j.Logger;

import dch.entity.Album;
import dch.entity.Page;
import dch.entity.Result;
import dch.entity.Video;
import dch.persistent.admin.dao.AlbumDao;
import dch.persistent.admin.dao.TypesDao;
import dch.persistent.admin.dao.VideoDao;
import dch.persistent.admin.impl.AlbumDaoImpl;
import dch.persistent.admin.impl.TypesDaoImpl;
import dch.persistent.admin.impl.VideoDaoImpl;
import dch.service.admin.dao.AlbumService;

public class AlbumServiceImpl implements AlbumService {

	private AlbumDao albumDao=null;
	TypesDao typeDao=null;
	VideoDao videoDao=null;
	Logger logger=Logger.getLogger(AlbumServiceImpl.class);
	
	public AlbumServiceImpl(){
		albumDao=new AlbumDaoImpl();
		typeDao=new TypesDaoImpl();
		videoDao=new VideoDaoImpl();
	}
	
	@Override
	public Result getPageRecords(Page page,String keyword) {
		
		return albumDao.queryByPage(keyword, page);
	}

	@Override
	public void deleteAlbum(int id) {
		albumDao.delete(id);
	}

	@Override
	public Album queryById(Integer id) {
		return albumDao.queryById(id);
	}
	
	@Override
	public void updateAlbum(Album a, String types) {
		albumDao.update(a,types);
	}
	
	@Override
	public List<Video> listVideo(int albumid) {
		return albumDao.queryAllVideo(albumid);
	}

	@Override
	public void insertAlbum(Album a, String types) {
		albumDao.insert(a,types);
	}
	public void close(){
		albumDao.close();
	}
}
